<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>小票打印机设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	.layui-form-label{width:130px!important}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					{if !$info['id']}<i class="fa fa-plus"></i> 添加易联云小票打印机{else}<i class="fa fa-pencil"></i> 编辑易联云小票打印机{/if}
					<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
				</div>
				<div class="layui-card-body" pad15>
					<div class="layui-form">
						<input type="hidden" name="info[id]" value="{$info.id}"/>
						<div class="layui-form-item">
							<label class="layui-form-label">所属商户：</label>
							<div class="layui-input-inline">
								<select name="info[bid]" lay-verify="required" lay-verType="tips">
								<option value="">--请选择--</option>
								{foreach $blist as $bv}
									<option value="{$bv['id']}" {if $bv['id']==$info['bid']}selected{/if}>{$bv['name']}</option>
								{/foreach}
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">名称：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.name}">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">小票标题：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[title]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.title}">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">应用ID：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[client_id]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.client_id}">
							</div>
							<div class="layui-form-mid layui-word-aux">请在 <a href="https://dev.10ss.net/" target="_blank">易联云</a> 创建<span style="color: red">自有型应用</span> 获取应用ID</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">应用密钥：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[client_secret]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.client_secret}">
							</div>
							<div class="layui-form-mid layui-word-aux">请在 <a href="https://dev.10ss.net/" target="_blank">易联云</a> 创建<span style="color: red">自有型应用</span> 获取应用密钥</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">Access Token：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[access_token]" class="layui-input" value="{$info.access_token}">
							</div>
							<div class="layui-form-mid layui-word-aux">请求token，不填写将自动获取</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">终端号：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[machine_code]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.machine_code}">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">终端密钥：</label>
							<div class="layui-input-inline" style="width:200px">
								<input type="text" name="info[msign]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.msign}">
							</div>
						</div>
						
						<div class="layui-form-item">
							<label class="layui-form-label">自动打印：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[autoprint]" value="1" title="开启" {if !$info['id'] || $info['autoprint']==1}checked{/if}>
								<input type="radio" name="info[autoprint]" value="0" title="关闭" {if $info['id'] && $info['autoprint']==0}checked{/if}>
							</div>
							<div class="layui-form-mid layui-word-aux">关闭自动打印后需要在订单列表手动点击打印才会打印</div>
						</div>
						
						<div id="autoprintset">
							<div class="layui-form-item">
								<label class="layui-form-label">配送订单：</label>
								<div class="layui-input-inline" style="width:500px">
									<input type="radio" name="info[print_ps]" value="1" title="打印" {if !$info['id'] || $info['print_ps']==1}checked{/if}>
									<input type="radio" name="info[print_ps]" value="0" title="不打印" {if $info['id'] && $info['print_ps']==0}checked{/if}>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">自提订单：</label>
								<div class="layui-input-inline" style="width:500px">
									<input type="radio" name="info[print_zt_type]" value="1" title="打印" {if !$info['id'] || $info['print_zt_type']==1}checked{/if}>
									<input type="radio" name="info[print_zt_type]" value="0" title="不打印" {if $info['id'] && $info['print_zt_type']==0}checked{/if}>
								</div>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label">音量大小：</label>
							<div class="layui-input-inline" style="width:600px">
								<input type="radio" name="info[voice]" value="0" title="不播报" {if $info['voice']==0}checked{/if}>
								<input type="radio" name="info[voice]" value="1" title="低音量" {if $info['voice']==1}checked{/if}>
								<input type="radio" name="info[voice]" value="2" title="中音量" {if $info['voice']==2}checked{/if}>
								<input type="radio" name="info[voice]" value="3" title="高音量" {if $info['voice']==3}checked{/if}>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">状态：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[status]" value="1" title="开启" {if !$info['id'] || $info['status']==1}checked{/if}>
								<input type="radio" name="info[status]" value="0" title="关闭" {if $info['id'] && $info['status']==0}checked{/if}>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label"></label>
							<div class="layui-input-block">
								<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	layui.form.on('radio(autoprint)',function(data){
		if(data.value == '1'){
			$('#autoprintset').show();
		}else{
			$('#autoprintset').hide();
		}
	})
	layui.form.on('radio(print_zt_type)',function(data){
		if(data.value == '2'){
			$('#print_zt_type_div').show();
		}else{
			$('#print_zt_type_div').hide();
		}
	})
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		//console.log(field);return;
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.close(parent.layer.getFrameIndex(window.name));
					parent.tableIns.reload()
				},1000)
			}
		})
	})
  </script>
	{include file="public/copyright"/}
</body>
</html>